package com.lin.springcloud.alibaba.controller;

import com.lin.springcloud.entities.CommonResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author Created by Lin Weihong
 * @date on 2022/5/15 18:51
 */
@RestController
public class OrderNacosController {
    @Resource
    private RestTemplate restTemplate;

    @Value("${service-url.nacos-user-service}")
    private String serverURL; //http://nacos-payment-provider


    @GetMapping("/consumer/payment/nacos/{id}")
    public String paymentInfo(@PathVariable("id") Long id) {
        String forObject = restTemplate.getForObject(serverURL + "/payment/nacos/" + id, String.class);
        return forObject;
    }
}
